/**
 * Provides utility methods for formatting strings
 * Do not instantiate this class...
 * @author Adam Contois, Adam Domurad, Pat Goebel
 *
 */
public class FormatUtil {
	/**
	 * Creates a human readable price from a price specified in cents
	 * @param price the price in number of cents
	 * @return human readable price string
	 */
	static final String formatPrice(int price){
		String r = Integer.toString(price%100);
		while (r.length() < 2){
			r = '0' + r;
		}
		r = Integer.toString(price/100) + '.' + r;
		return r;
	}

	
	/**
	 * Takes a number, of at least length 'digits' padded with 0s at the front
	 * @param num
	 * @param digits
	 * @return zero padded string
	 */
	static final String padFrontWithZeros(int num, int digits){
		String r = Integer.toString(num);
		while (r.length() < digits){
			r = '0' + r;
		}
		return r;
	}
	
	/**
	 * Takes a string, and returns a string of at least length 'chars' padded with spaces at the end
	 * @param s string to pad
	 * @param chars number of digits in total
	 * @return space padded string
	 */
	static final String padEndWithSpaces(String s, int chars){
		while (s.length() < chars)
			s = s + ' ';
		return s;
	}
}
